package com.jeeplus.modules.monitor.task;

import com.jeeplus.common.utils.SpringContextHolder;
import com.jeeplus.modules.monitor.entity.Task;
import com.jeeplus.modules.sys.mapper.SystemMapper;
import com.jeeplus.modules.wxMsg.SendWX;
import org.activiti.engine.impl.persistence.entity.TaskEntity;
import org.quartz.DisallowConcurrentExecution;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@DisallowConcurrentExecution
public class ActAutoWx extends Task {

	private static SystemMapper systemMapper = SpringContextHolder.getBean(SystemMapper.class);

	@Override
	public void run() {
		HashMap<String, String> map = new HashMap<>();
		List<Map> resList = systemMapper.getActToWxList();

		int s = resList.size();
		if (s > 0) {
			for (int k = 0; k < s; k++) {
				String wx = resList.get(k).values().toString();
				String res = wx.replaceAll("\\[|\\]","" );
				/*System.out.println("=============");
				System.out.println(res);*/
				SendWX.send(res,"您有工作流待办任务尚未处理,请尽快登录系统处理尽快!",new TaskEntity());
			}
		}
	}

}
